<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>DateTimeZone 类</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="datetime.wakeup.html">« DateTime::__wakeup</a></li>
      <li style="float: right;"><a href="datetimezone.construct.html">DateTimeZone::__construct »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.datetime.html">日期/时间</a></li>
    <li>DateTimeZone 类</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="class.datetimezone" class="reference">

 <h1 class="title">DateTimeZone 类</h1>
 

 <div class="partintro"><p class="verinfo">(PHP 5 &gt;= 5.2.0, PHP 7, PHP 8)</p>


  <div class="section" id="datetimezone.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    时区表示。
   </p>
  </div>


  <div class="section" id="datetimezone.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass">
     
    </div>

    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">class</span> <strong class="classname">DateTimeZone</strong>
     </span>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 常量 */</div>
    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.datetimezone.html#datetimezone.constants.africa"><var class="varname">AFRICA</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.datetimezone.html#datetimezone.constants.america"><var class="varname">AMERICA</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.datetimezone.html#datetimezone.constants.antarctica"><var class="varname">ANTARCTICA</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.datetimezone.html#datetimezone.constants.arctic"><var class="varname">ARCTIC</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.datetimezone.html#datetimezone.constants.asia"><var class="varname">ASIA</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.datetimezone.html#datetimezone.constants.atlantic"><var class="varname">ATLANTIC</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.datetimezone.html#datetimezone.constants.australia"><var class="varname">AUSTRALIA</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.datetimezone.html#datetimezone.constants.europe"><var class="varname">EUROPE</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.datetimezone.html#datetimezone.constants.indian"><var class="varname">INDIAN</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.datetimezone.html#datetimezone.constants.pacific"><var class="varname">PACIFIC</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.datetimezone.html#datetimezone.constants.utc"><var class="varname">UTC</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.datetimezone.html#datetimezone.constants.all"><var class="varname">ALL</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.datetimezone.html#datetimezone.constants.all-with-bc"><var class="varname">ALL_WITH_BC</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.datetimezone.html#datetimezone.constants.per-country"><var class="varname">PER_COUNTRY</var></a></var>;</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="datetimezone.construct.html" class="methodname">__construct</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$timezone</code></span>)</div>

    <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="datetimezone.getlocation.html" class="methodname">getLocation</a></span>(): <span class="type"><span class="type">array</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="datetimezone.getname.html" class="methodname">getName</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="datetimezone.getoffset.html" class="methodname">getOffset</a></span>(<span class="methodparam"><span class="type"><a href="class.datetimeinterface.html" class="type DateTimeInterface">DateTimeInterface</a></span> <code class="parameter">$datetime</code></span>): <span class="type">int</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="datetimezone.gettransitions.html" class="methodname">getTransitions</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$timestampBegin</code><span class="initializer"> = <strong><code>PHP_INT_MIN</code></strong></span></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter">$timestampEnd</code><span class="initializer"> = <strong><code>PHP_INT_MAX</code></strong></span></span>): <span class="type"><span class="type">array</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><a href="datetimezone.listabbreviations.html" class="methodname">listAbbreviations</a></span>(): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><a href="datetimezone.listidentifiers.html" class="methodname">listIdentifiers</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$timezoneGroup</code><span class="initializer"> = DateTimeZone::ALL</span></span>, <span class="methodparam"><span class="type">?</span><span class="type"><span class="type">string</span><span class="type"></span></span> <code class="parameter">$countryCode</code><span class="initializer"> = <strong><code>null</code></strong></span></span>): <span class="type">array</span></div>

   }</div>


  </div>
  

  <div class="section" id="datetimezone.constants">
   <h2 class="title">预定义常量</h2>
   <dl>
    
     <dt id="datetimezone.constants.africa"><strong><code>DateTimeZone::AFRICA</code></strong></dt>

     <dd>

      <p class="para">非洲时区。</p>
     </dd>

    

    
     <dt id="datetimezone.constants.america"><strong><code>DateTimeZone::AMERICA</code></strong></dt>

     <dd>

      <p class="para">美洲时区。</p>
     </dd>

    

    
     <dt id="datetimezone.constants.antarctica"><strong><code>DateTimeZone::ANTARCTICA</code></strong></dt>

     <dd>

      <p class="para">南极洲时区。</p>
     </dd>

    

    
     <dt id="datetimezone.constants.arctic"><strong><code>DateTimeZone::ARCTIC</code></strong></dt>

     <dd>

      <p class="para">北极时区。</p>
     </dd>

    

    
     <dt id="datetimezone.constants.asia"><strong><code>DateTimeZone::ASIA</code></strong></dt>

     <dd>

      <p class="para">亚洲时区。</p>
     </dd>

    

    
     <dt id="datetimezone.constants.atlantic"><strong><code>DateTimeZone::ATLANTIC</code></strong></dt>

     <dd>

      <p class="para">大西洋时区。</p>
     </dd>

    

    
     <dt id="datetimezone.constants.australia"><strong><code>DateTimeZone::AUSTRALIA</code></strong></dt>

     <dd>

      <p class="para">澳洲时区。</p>
     </dd>

    

    
     <dt id="datetimezone.constants.europe"><strong><code>DateTimeZone::EUROPE</code></strong></dt>

     <dd>

      <p class="para">欧洲时区。</p>
     </dd>

    

    
     <dt id="datetimezone.constants.indian"><strong><code>DateTimeZone::INDIAN</code></strong></dt>

     <dd>

      <p class="para">印度洋（Indian）时区。</p>
     </dd>

    

    
     <dt id="datetimezone.constants.pacific"><strong><code>DateTimeZone::PACIFIC</code></strong></dt>

     <dd>

      <p class="para">太平洋时区。</p>
     </dd>

    

    
     <dt id="datetimezone.constants.utc"><strong><code>DateTimeZone::UTC</code></strong></dt>

     <dd>

      <p class="para">UTC 时区。</p>
     </dd>

    

    
     <dt id="datetimezone.constants.all"><strong><code>DateTimeZone::ALL</code></strong></dt>

     <dd>

      <p class="para">所有时区。</p>
     </dd>

    

    
     <dt id="datetimezone.constants.all-with-bc"><strong><code>DateTimeZone::ALL_WITH_BC</code></strong></dt>

     <dd>

      <p class="para">所有时区，包含向后兼容。</p>
     </dd>

    

    
     <dt id="datetimezone.constants.per-country"><strong><code>DateTimeZone::PER_COUNTRY</code></strong></dt>

     <dd>

      <p class="para">每个国家的时区。</p>
     </dd>

    

   </dl>

  </div>



 </div>

 




















































<h2>目录</h2><ul class="chunklist chunklist_reference"><li><a href="datetimezone.construct.html">DateTimeZone::__construct</a> — 创建新的DateTimeZone对象</li><li><a href="datetimezone.getlocation.html">DateTimeZone::getLocation</a> — 返回与时区相关的定位信息</li><li><a href="datetimezone.getname.html">DateTimeZone::getName</a> — 返回时区名称</li><li><a href="datetimezone.getoffset.html">DateTimeZone::getOffset</a> — 返回相对于 GMT 的时差</li><li><a href="datetimezone.gettransitions.html">DateTimeZone::getTransitions</a> — Returns all transitions for the timezone</li><li><a href="datetimezone.listabbreviations.html">DateTimeZone::listAbbreviations</a> — 返回一个包含 dst (夏令时)，时差和时区信息的关联数组。</li><li><a href="datetimezone.listidentifiers.html">DateTimeZone::listIdentifiers</a> — 返回包含了所有时区标识符的数字索引数组</li></ul>
</div>
</div></div></body></html>